from FrameContentGeneric import FrameContentGeneric
from Tkinter import *
import time

class AnimatedImageControl(FrameContentGeneric):

    _images = None
    _continue = True

    def __init__(self, master, images):
        Frame.__init__(self,master)
        self._images = images

    def pre_load(self):
        photo1 = PhotoImage(file=self._images[0])
        width1 = photo1.width()
        height1 = photo1.height()
        canvas1 = Canvas(self,width=width1, height=height1)
        canvas1.grid(column=0, row=0)

        # loop through the series of GIFs
#        while self._continue:
        for k in range(0, 1000):
            photo1 = PhotoImage(file=self._images[k%7])
            canvas1.create_image(width1/2.0, height1/2.0, image=photo1)
            canvas1.update()
            time.sleep(0.1)



    def stop(self):
        self._continue = false